package com.example.administrator.yuejian35.Find;

import com.example.administrator.yuejian35.Config;
import com.example.administrator.yuejian35.Home.HomeServer;

import java.util.List;
import java.util.Map;

import okhttp3.MultipartBody;
import okhttp3.RequestBody;
import retrofit2.Call;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;

/**
 * Created by JUSTIN on 2017/9/26.
 */

public class FindModel {
    private Retrofit retrofit;
    private FindServer service;

    public FindModel(){
        retrofit =
                new Retrofit.Builder()
                        .baseUrl(Config.BASE_URL)
                        .addConverterFactory(GsonConverterFactory.create())
                        .build();
    }

    private void service(){
        service=retrofit.create(FindServer.class);
    }


    public Call postlist()
    {
        service();
        return  service.postlist();
    }

    public Call getPostByUser(String uid)
    {
        service();
        return  service.getPostByUser(uid);
    }

    public Call deletepost(String pid)
    {
        service();
        return  service.deletepost(pid);
    }

    public Call postpic(int pid)
    {
        service();
        return  service.postpic(pid);
    }

    public Call commentlist(int pid)
    {
        service();
        return  service.commentlist(pid);
    }

    public Call addpost(int uid, String content, MultipartBody.Part file)
    {
        service();
        return  service.addpost(uid,content,file);
    }

    public Call addmore(String uid, String content, Map<String,RequestBody> file)
    {
        service();
        return  service.addmore(uid,content,file);
    }

    public Call post_collect(String pid,String uid,String type, String id) //收藏
    {
        service();
        return  service.post_collect(pid,uid,type,id);
    }

    public Call comment_hit(String pid,String type) //比赛点赞
    {
        service();
        return  service.comment_hit(pid,type);
    }

    public Call comment(String pid,String uid,String content) //比赛点赞
    {
        service();
        return  service.comment(pid,uid,content);
    }



}
